package com.singleton;

public class SingletonTest2 {
    private SingletonTest2(){}
    private static class ClassHolder{
        private final static SingletonTest2 t = new SingletonTest2();
    }
    public static SingletonTest2 getInstance(){
        return ClassHolder.t;
    }
    public void m(){
        System.out.println("m");
    }

    public static void main(String[] args) {
        for(int i = 0; i < 100; i ++){
            new Thread(() -> {
                System.out.println(SingletonTest2.getInstance().hashCode());
            }).start();
        }
    }
}
